package com.boomsecret.juc.atomic;

import java.util.concurrent.atomic.AtomicStampedReference;

/**
 * @author wangjinliang on 2019/1/17.
 */
public class AtomicStampedReferenceDemo {
    public static void main(String[] args) {
        // 和AtomicMarkableReference差不多 可以解决ABA问题
        AtomicStampedReference<String> atomicStampedReference = new AtomicStampedReference<>("aa", 123);
        System.out.println(atomicStampedReference.getReference());
        System.out.println(atomicStampedReference.getStamp());

        System.out.println("---------------------------");
        int[] stampHolder = {123};
        System.out.println(atomicStampedReference.get(stampHolder));
    }
}
